import { createRouter, createWebHistory } from 'vue-router'
import Layout from "@/layout/Layout";
import HomePage from "@/layout/HomePage";
import testNew from "@/layout/testNew";
import login from "@/layout/login";

const routes = [
  {
    // 首页
    path: '/',
    name: 'HomePage',
    component: HomePage,
  },
  {
    // 后台管理页面
    path: '/layout',
    name: 'Layout',
    redirect: "/home",
    component: Layout ,
    children: [
      {
        path: '/home',
        name: 'Home',
        component: () => import("@/views/Home"),
      },
      {
        path: '/courseManage',
        name: 'courseManage',
        component: () => import("@/views/courseManage"),
      },
      {
        path: '/userPurchase',
        name: 'userPurchase',
        component: () => import("@/views/userPurchase"),
      },
      {
        path: '/userLogManage',
        name: 'userLogManage',
        component: () => import("@/views/userLogManage"),
      },
      {
        path: '/messageManage',
        name: 'messageManage',
        component: () => import("@/views/messageManage"),
      },
      {
        path: '/passwordChange',
        name: 'passwordChange',
        component: () => import("@/views/passwordChange"),
      },
      {
        // 课程类别总览页面
        path: '/courseCounter',
        name: 'courseCounter',
        component: () => import("@/views/courseCounter"),
      }
    ]
  },

  {
    path: '/testNew',
    name: 'testNew',
    component: testNew,

  },
  {
    // 登录页面
    path: '/login',
    name: 'login',
    redirect: "/login_password",
    component: login,
    children:[
      {
        path: '/login_password',
        name: 'login_password',
        component: () => import("@/views/login_password.vue")

      },
      {
        path: '/login_message',
        name: 'login_message',
        component: () => import("@/views/login_message.vue")

      },
    ]
  },
  {
    // 注册页面
    path: '/register',
    name: 'register',
    component: () => import("../views/register.vue")
  },
  {
    // 用户中心页面
    path: '/userCenter',
    name: 'userCenter',
    component: () => import("../views/userCenter.vue")
  },
  {
    // 课程详情页
    path: '/courseDetails',
    name: 'courseDetails',
    component: () => import("@/views/courseDetails"),
  },
  {
    // 课程详情页
    path: '/test',
    name: 'test',
    component: () => import("@/views/test"),
  },
  {
    // 更多课程页面
    path: '/moreCourse',
    name: 'moreCourse',
    component: () => import("@/views/moreCourse"),
  },
  {
    // 更多课程页面
    path: '/orderFiltering',
    name: 'orderFiltering',
    component: () => import("@/views/orderFiltering"),
  }

]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
